package com.mofang.powerdekorhelper.activity.activity;

import android.view.View;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.adapter.SignInListAdapter;
import com.mofang.powerdekorhelper.base.MvpActivity;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewGrid;
import com.mofang.powerdekorhelper.model.ActivityDetail;
import com.mofang.powerdekorhelper.model.SignUpList;
import com.mofang.powerdekorhelper.persenter.SignPersenter;
import com.mofang.powerdekorhelper.utils.LoadPrograss;
import com.mofang.powerdekorhelper.utils.T;
import com.mofang.powerdekorhelper.view.SignView;
import com.mofang.powerdekorhelper.witget.TitleBar;

import butterknife.BindView;

/**
 * Created by luofei on 2017/8/28 0028.
 * 说明：签到列表
 */

public class ActivitySignInAct extends MvpActivity<SignView, SignPersenter> implements SignView {

    @BindView(R.id.sign_in_titlebar)
    TitleBar mTitleBar;

    @BindView(R.id.sign_in_grid)
    BaseRecycleViewGrid signInGrid;

    LoadPrograss loadPrograss;

    private Integer activityId;

    private ActivityDetail.Result result;

    @Override
    public void initView() {
        inflateLayout(R.layout.activity_sign_in_layout);
        initTitleBarWithback(mTitleBar, R.string.activity_sign_up);
        loadPrograss = new LoadPrograss(this);
        signInGrid.setColumNum(5, false);
    }

    @Override
    public void initData() {

        activityId = getIntent().getIntExtra("ActivityId", -1);

        result = (ActivityDetail.Result) getIntent().getSerializableExtra("SignInList");

        if (result != null) {
            SignInListAdapter adapter = new SignInListAdapter(result.getPictures(), this, R.layout.sign_up_list_item_layout);
            signInGrid.setAdapter(adapter);
        }

        //presenter.getSignUpList(activityId);
    }

    @Override
    public void setSignUpList(SignUpList signUpList) {

       /* SignInListAdapter adapter = new SignInListAdapter(result.getPictures(), this, R.layout.sign_up_list_item_layout);
        signInGrid.setAdapter(adapter);*/

        hideProgress();
    }

    @Override
    public void showProgress() {
        loadPrograss.show();
    }

    @Override
    public void hideProgress() {
        loadPrograss.hide();
    }

    @Override
    public void toast(CharSequence s) {
        T.showShort(this, s);
    }

    @Override
    public void toast(int id) {

    }

    @Override
    public void showNullLayout() {

    }

    @Override
    public void hideNullLayout() {

    }

    @Override
    public void showErrorLayout(View.OnClickListener listener) {

    }

    @Override
    public void hideErrorLayout() {

    }

    @Override
    public void onError(String errorInfo) {
        hideProgress();
        toast(errorInfo);
    }

    @Override
    public SignPersenter initPresenter() {
        return new SignPersenter();
    }
}
